package com.zhf.mapper;

import com.zhf.domain.Article;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: ZhaoHuanfeng
 * @Date: 2020/11/15 14:58
 */
public interface ArticleMapper {

    @Select("select * from t_article")
    @Results({
            @Result(property = "id",column = "id",id = true),
            @Result(property = "title",column = "title"),
            @Result(property = "content",column = "content"),
            @Result(property = "commentList",javaType = List.class,column = "id",many = @Many(select = "com.zhf.mapper.CommentMapper.findByAid"))
    })
    public List<Article> findAll();
}
